using System;
using DC2010.Objects;
using DC2010.Objects.Base;
using DC2010.Objects.Data;

namespace DC2010.Effects
{
/// Effect description
/// 
/// Param1 - Water value
/// Param2 - UNUSED
/// Param3 - UNUSED
/// Param4 - UNUSED
/// Param5 -  UNUSED
/// sParam1 - Direction, can be negative as well as positive, values are: "+", "-".
/// sParam1 - UNUSED
    
    public class I_Drink_Effect : EffectLogic
    {
        public I_Drink_Effect(EffectData ed) : base(ed)
        {
            ShortName = "DRINK";
            LongName = "Effect increases/decreses water value for creature.";
            Id = "I_DRINK_EFFECT";
            EffectType = EffectType.Instant;
        }

        public override void Instant(BaseObject aInvoker, BaseObject aTarget)
        {
            if (aInvoker is CreatureData)
            {
                CreatureData c = (CreatureData) aInvoker;

                string pAmount = Data.Params.Find(A => A.Key == "AMOUNT").Value;
                string pDirection = Data.Params.Find(A => A.Key == "DIRECTION").Value;
                int Amount;
                Int32.TryParse(pAmount, out Amount);


                if (pDirection == "-")
                    c.Attributes.Water.Dec(Amount);
                else
                    c.Attributes.Water.Add(Amount);
            }

            base.Instant(aInvoker, aTarget);
        }
    }
}

